﻿function master() {
    this.focus = function(sel, val) { $(sel).onfocus({ value: val }); }
    this.switchBanner = function(sel, option) { $(sel).TopBanner(option); }
    this.toggleClass = function(sel, option) { $(sel).addClasses(option); }
    this.photoGallery = function(sel, option) { $(sel).gallery(option); }
    this.countDown = function (sel, option) { $(sel).timeLeft(option); }
    this.popup = function (content, hasGray) {
        var cssBox = { "border": "2px solid #fada6e", " padding": "15px", "position": "absolute", "z-index": "9999" };
        var cssClosed = { "background": "url(images/style_default/common/popUpClosed.png) no-repeat", "width": "28px", "height": "28px", "margin": "5px 5px 0 0", "cursor": "pointer", "position": "absolute", "right":"0"}
        var box = "<div class=\"popup\"></div>"
        var closed = "<div class=\"closed\"></div>"
        var grayBg;
        if (hasGray) { grayBg = "<div class=\"grayDiv\"></div>"; }
        var windowW = $(window).width();
        var windowH = $(window).height();
        $("body").append(box).append(grayBg);
        $(".popup").css(cssBox);
        $('.grayDiv').css({ "width": windowW, "height": windowH });
        $(".popup").append(closed).append(content);
        $(".popup .closed").css(cssClosed);
        var boxHeight = $(".content").outerHeight();
        if ($.browser.msie && ($.browser.version == "7.0")) { boxHeight = boxHeight; }
        var boxWidth = $(".content").outerWidth();
        var positionTop = (boxHeight / 2) + "px";
        var positionLeft = (boxWidth / 2) + "px";
        cssBox = { "border": "2px solid #fada6e", " padding": "15px", "position": "absolute", "z-index": "9999", "left": "50%", "top": "50%", "margin-left": "-" + positionLeft, "margin-top": "-" + positionTop, "width": boxWidth, "height": boxHeight, "background": "#fff" };
        $(".popup").css(cssBox);
        $(".popup .closed").click(function () {
            $(".grayDiv").remove();
            $(".popup").remove();
        });
    } //popup
    this.showBox = function(sel, option) { $(sel).selectShow(option); }
    this.showBox1 = function (sel, option) { $(sel).selectShow1(option); }
    this.tabs = function (sel, option) { $(sel).switchTabs(option); }
}

